<#
    .Author
    Trevor Sullivan
    
    .Date
    2014-06-17

    .Description
    Creates the root "Mercurial" add-on menu for the PowerShell ISE, and assigns
    the menu to a variable called $HgMenu, so that we can add child menu items.
#>
# Clean up menu
[void]($psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Where({ $PSItem.DisplayName -match '^_Mercurial'; }) | % { $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Remove($PSItem); });

# Create menu
$HgMenu = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('_Mercurial', $null, $null);